Imports Telerik.Web.UI
Imports System.Data
Imports CL_ORM

Partial Class Processes_Purchase_ItemsSearch


    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Fill Page Title Info.
        'Dim lbl As Label
        'lbl = Me.Master.FindControl("lblPageTitle")
        'lbl.Text = GetLocalResourceObject("PageTitle")
        Page.Title = GetLocalResourceObject("PageTitle")



        If Not IsPostBack Then

            'Me.dt_Date_f.DbSelectedDate = Now
            'Me.dt_Date_t.DbSelectedDate = Now


            Dim SesClass As New SessionClass
            SesClass = Session("UserInfo")
            hdnUserName.Value = SesClass.getFullName
            hdnMang.Value = SesClass.getEmp_Managment
            hdnEmp_No.Value = SesClass.getEmp_No
            btnBack.Attributes.Add("onclick", "window.close(); return false;")



        End If
    End Sub

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Me.Theme = GetGlobalResourceObject("SystemResource", "Theme")
    End Sub

    Protected Sub rgMaterials_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgSearch.ItemDataBound
        If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
            'e.Item.Cells(5).Text = Me.hdnUserName.Value
            'e.Item.Cells(6).Text = Me.hdnMang.Value
        End If

    End Sub

    Protected Sub rgMaterials_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgSearch.NeedDataSource
        If e.RebindReason = GridRebindReason.InitialLoad Then
            Dim emptyTable As New DataTable()
            rgSearch.DataSource = emptyTable
        End If
    End Sub


    Protected Sub cmdRetrive_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdRetrive.Click
        rgSearch.DataBind()
    End Sub

    Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSend.Click
        Dim i As Integer
        Dim st As String = ""
        For i = 0 To Me.rgSearch.Items.Count - 1
            st = st & IIf(CType(rgSearch.Items(i).Cells(2).FindControl("choose"), CheckBox).Checked = "True", _
            rgSearch.Items(i).Cells(2).Text & "+", "")
        Next i

        OrdersString.Value = st

        Page.ClientScript.RegisterStartupScript(Me.GetType, "StartupScript", "<Script>transferData();</Script>")
        'OrdersString.Value = ""

        'Me.btnSend.Attributes.Add("onClick", "transferData()")

    End Sub
End Class
